home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Demos / Extend 3.0 Demo / Demo Libraries / Demo Engineering Lib / Demo Engineering Lib.rsrc / MODL_26792_Clipper < prev    next >
Encoding:
Text File  |  1994-06-22  |  1.7 KB  |  66 lines

  1. real lower, upper;
  2.  
  3. on ok
  4. {
  5. if (novalue(lim1+lim2))    ** novalue added to anything is novalue!!!
  6.     {
  7.     usererror("Please enter limits or click Cancel");
  8.     abort;
  9.     }
  10. }
  11.  
  12. on checkdata
  13. {
  14. if (novalue(lim1+lim2))
  15.     abort;
  16. }
  17.  
  18. on initsim
  19. {
  20. lower = lim1;
  21. upper = lim2;
  22. if (lower > upper)
  23.     {
  24.     lower = upper;
  25.     upper = lim1;
  26.     }
  27. }
  28. on simulate
  29. {
  30. if (con1in > upper)
  31.     con2out = upper;
  32. else if (con1in < lower)
  33.     con2out = lower;
  34. else
  35.     con2out = con1in;
  36.     
  37. ** sysGlobal2 is the file reference number for the DEBUG TRACE
  38. if( sysGlobal2 != 0.0 )    ** 0 is error, check for open file for TRACE
  39.     {
  40. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  41.     fileWrite(sysGlobal2,"Clipper                  block number "+(MyBlockNumber())+".  Current Time:"+currentTime+".","",True);
  42.     if(getBlockLabel(myBlockNumber()) != "")
  43.         fileWrite(sysGlobal2,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  44.     fileWrite(sysGlobal2,"     Input = "+con1In,"",True);
  45.     fileWrite(sysGlobal2,"     Output = "+con2Out,"",True);
  46.     fileWrite(sysGlobal2," ","",True);
  47.     }
  48. }
  49.  
  50. on endSim
  51. {
  52. ** sysGlobal1 is the file reference number for the TEXT REPORT
  53. if( sysGlobal1 != 0.0 ) ** 0 is error, check for open file for REPORT
  54.     {
  55. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  56.     fileWrite(sysGlobal1,"Clipper                  block number "+(MyBlockNumber()),"",True);
  57.     if(getBlockLabel(myBlockNumber()) != "")
  58.         fileWrite(sysGlobal1,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  59.     fileWrite(sysGlobal1,"     Upper Limit = "+upper,"",True);
  60.     fileWrite(sysGlobal1,"     Lower Limit = "+lower,"",True);
  61.     if( comments != "" )
  62.         fileWrite(sysGlobal1,"     Comments = "+comments,"",True);        
  63.     fileWrite(sysGlobal1," ","",True);
  64.     }
  65. }
  66.